package com.jiajia.study.member.controller;

import com.jiajia.common.utils.R;
import com.jiajia.study.member.entity.MemberEntity;
import com.jiajia.study.member.feign.CouponFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zjiajia
 * @date 2025/6/10 11:31
 */

@RestController
@RequestMapping("member/feign")
public class MemberFeignController {



    @Autowired
    private CouponFeignService couponFeignService;

    /**
     * feign 远程调用测试
     * @return  结果
     */
    @GetMapping("coupons")
    public R memberCoupons(){
        MemberEntity memberEntity = new MemberEntity();

        memberEntity.setNickname("张三");

        R couponsResult = couponFeignService.memberCoupons();

        return R.ok().put("member", memberEntity).put("coupons", couponsResult.get("coupons"));
    }
}
